<?php
	require_once( 'core_DataBaseConnect.php' );
	require_once( 'core_ErrorCode.php' );
	require_once( 'core_Response.php' );
	require_once( 'dao_BusinessDAO.php' );
	require_once( '_configs.php' );
	
	function func( $con, $post, $returnType )
	{
		// 1. 전체 사업 수
		$response = array();
		$response[ 'count' ] = BusinessDAO::countBusinesses( $con );
		
		// 2. 조회
		$result = BusinessDAO::selectBusinesses( $con, $post[ 'page' ], $post[ 'numPerPage' ] );
		$response[ 'business' ] = array();
		while( $fetch = DataBaseConnect::fetch_assoc( $result ) )
		{
			array_push( $response[ 'business' ], DataBaseConnect::fetchSerialize( $fetch, array( 'CODE', 'B_CODE', 'NAME', 'PROPOSE_DATE', 'DECISION_DATE', 'REF', 'REF_LICENSE' ) ) );
		}
		
		return Response::SUCCESS( $response, $returnType );
	}
?>